package org.hxzon.demo.jna;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;

public class JnaDemo1 {
    //I need to use a COM/OCX/ActiveX object. Can JNA do that?
    //Not really. Try JACOB or com4j, both of which can parse a COM interface definition 
    //and generate a Java object to match it. JNAerator is also working on generating COM bindings.
    public interface CLibrary extends Library {
        CLibrary INSTANCE = (CLibrary) Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"), CLibrary.class);

        //映射需要的方法
        void printf(String format, Object... args);
    }

    public static void main(String[] args) {

        CLibrary.INSTANCE.printf("Hello, World,你好\n");
    }
}
